package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

cc_library(
    name = "hybrid_config",
    srcs = ["hybrid_config.cc"],
    hdrs = ["hybrid_config.h"],
    include_prefix = "tink/hybrid",
    visibility = ["//visibility:public"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager",
        ":ecies_aead_hkdf_public_key_manager",
        ":hybrid_decrypt_wrapper",
        ":hybrid_encrypt_wrapper",
        "//:registry",
        "//aead:aead_config",
        "//config:config_util",
        "//config:tink_fips",
        "//proto:config_cc_proto",
        "//util:status",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/memory",
    ],
)

cc_library(
    name = "hybrid_decrypt_wrapper",
    srcs = ["hybrid_decrypt_wrapper.cc"],
    hdrs = ["hybrid_decrypt_wrapper.h"],
    include_prefix = "tink/hybrid",
    deps = [
        "//:crypto_format",
        "//:hybrid_decrypt",
        "//:primitive_set",
        "//:primitive_wrapper",
        "//proto:tink_cc_proto",
        "//subtle:subtle_util_boringssl",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "hybrid_encrypt_wrapper",
    srcs = ["hybrid_encrypt_wrapper.cc"],
    hdrs = ["hybrid_encrypt_wrapper.h"],
    include_prefix = "tink/hybrid",
    deps = [
        "//:crypto_format",
        "//:hybrid_encrypt",
        "//:primitive_set",
        "//:primitive_wrapper",
        "//proto:tink_cc_proto",
        "//subtle:subtle_util_boringssl",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "hybrid_decrypt_factory",
    srcs = ["hybrid_decrypt_factory.cc"],
    hdrs = ["hybrid_decrypt_factory.h"],
    include_prefix = "tink/hybrid",
    deps = [
        ":hybrid_decrypt_wrapper",
        "//:hybrid_decrypt",
        "//:key_manager",
        "//:keyset_handle",
        "//:primitive_set",
        "//:registry",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/base:core_headers",
    ],
)

cc_library(
    name = "hybrid_encrypt_factory",
    srcs = ["hybrid_encrypt_factory.cc"],
    hdrs = ["hybrid_encrypt_factory.h"],
    include_prefix = "tink/hybrid",
    deps = [
        ":hybrid_encrypt_wrapper",
        "//:hybrid_encrypt",
        "//:key_manager",
        "//:keyset_handle",
        "//:primitive_set",
        "//:registry",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/base:core_headers",
    ],
)

cc_library(
    name = "hybrid_key_templates",
    srcs = ["hybrid_key_templates.cc"],
    hdrs = ["hybrid_key_templates.h"],
    include_prefix = "tink/hybrid",
    visibility = ["//visibility:public"],
    deps = [
        "//aead:aead_key_templates",
        "//daead:deterministic_aead_key_templates",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "ecies_aead_hkdf_dem_helper",
    srcs = ["ecies_aead_hkdf_dem_helper.cc"],
    hdrs = ["ecies_aead_hkdf_dem_helper.h"],
    include_prefix = "tink/hybrid",
    visibility = ["//visibility:private"],
    deps = [
        "//:aead",
        "//:deterministic_aead",
        "//:key_manager",
        "//:registry",
        "//daead/subtle:aead_or_daead",
        "//proto:aes_ctr_hmac_aead_cc_proto",
        "//proto:aes_gcm_cc_proto",
        "//proto:aes_siv_cc_proto",
        "//proto:common_cc_proto",
        "//proto:tink_cc_proto",
        "//proto:xchacha20_poly1305_cc_proto",
        "//util:errors",
        "//util:protobuf_helper",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
    ],
)

cc_library(
    name = "ecies_aead_hkdf_hybrid_decrypt",
    srcs = ["ecies_aead_hkdf_hybrid_decrypt.cc"],
    hdrs = ["ecies_aead_hkdf_hybrid_decrypt.h"],
    include_prefix = "tink/hybrid",
    visibility = ["//visibility:private"],
    deps = [
        ":ecies_aead_hkdf_dem_helper",
        "//:hybrid_decrypt",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//subtle:ec_util",
        "//subtle:ecies_hkdf_recipient_kem_boringssl",
        "//util:enums",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
    ],
)

cc_library(
    name = "ecies_aead_hkdf_hybrid_encrypt",
    srcs = ["ecies_aead_hkdf_hybrid_encrypt.cc"],
    hdrs = ["ecies_aead_hkdf_hybrid_encrypt.h"],
    include_prefix = "tink/hybrid",
    visibility = ["//visibility:private"],
    deps = [
        ":ecies_aead_hkdf_dem_helper",
        "//:aead",
        "//:hybrid_encrypt",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//subtle:ecies_hkdf_sender_kem_boringssl",
        "//util:enums",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "ecies_aead_hkdf_private_key_manager",
    srcs = ["ecies_aead_hkdf_private_key_manager.cc"],
    hdrs = ["ecies_aead_hkdf_private_key_manager.h"],
    include_prefix = "tink/hybrid",
    visibility = [
        "//:__subpackages__",
        "//objc:__subpackages__",
    ],
    deps = [
        ":ecies_aead_hkdf_hybrid_decrypt",
        ":ecies_aead_hkdf_public_key_manager",
        "//:core/key_type_manager",
        "//:core/private_key_type_manager",
        "//:hybrid_decrypt",
        "//:key_manager",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//subtle:subtle_util_boringssl",
        "//util:constants",
        "//util:enums",
        "//util:errors",
        "//util:protobuf_helper",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "//util:validation",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "ecies_aead_hkdf_public_key_manager",
    srcs = ["ecies_aead_hkdf_public_key_manager.cc"],
    hdrs = ["ecies_aead_hkdf_public_key_manager.h"],
    include_prefix = "tink/hybrid",
    visibility = [
        "//:__subpackages__",
        "//objc:__subpackages__",
    ],
    deps = [
        ":ecies_aead_hkdf_hybrid_encrypt",
        "//:core/key_type_manager",
        "//:hybrid_encrypt",
        "//:key_manager",
        "//:registry",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//util:constants",
        "//util:protobuf_helper",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/strings",
    ],
)

# tests

cc_test(
    name = "hybrid_config_test",
    size = "small",
    srcs = ["hybrid_config_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    tags = [
        "fips",
    ],
    deps = [
        ":hybrid_config",
        ":hybrid_key_templates",
        "//:config",
        "//:hybrid_decrypt",
        "//:hybrid_encrypt",
        "//:keyset_handle",
        "//:registry",
        "//config:tink_fips",
        "//util:status",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "hybrid_decrypt_wrapper_test",
    size = "small",
    srcs = ["hybrid_decrypt_wrapper_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":hybrid_decrypt_wrapper",
        "//:hybrid_decrypt",
        "//:primitive_set",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "hybrid_encrypt_wrapper_test",
    size = "small",
    srcs = ["hybrid_encrypt_wrapper_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":hybrid_encrypt_wrapper",
        "//:hybrid_encrypt",
        "//:primitive_set",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "hybrid_decrypt_factory_test",
    size = "small",
    srcs = ["hybrid_decrypt_factory_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_public_key_manager",
        ":hybrid_config",
        ":hybrid_decrypt_factory",
        "//:config",
        "//:hybrid_decrypt",
        "//:hybrid_encrypt",
        "//:keyset_handle",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:test_keyset_handle",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "hybrid_encrypt_factory_test",
    size = "small",
    srcs = ["hybrid_encrypt_factory_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":hybrid_config",
        ":hybrid_encrypt_factory",
        "//:config",
        "//:hybrid_encrypt",
        "//:keyset_handle",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:test_keyset_handle",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "hybrid_key_templates_test",
    size = "small",
    srcs = ["hybrid_key_templates_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager",
        ":hybrid_config",
        ":hybrid_key_templates",
        "//aead:aead_key_templates",
        "//daead:deterministic_aead_key_templates",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//util:test_matchers",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ecies_aead_hkdf_dem_helper_test",
    size = "small",
    srcs = ["ecies_aead_hkdf_dem_helper_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_dem_helper",
        "//:registry",
        "//aead:aes_gcm_key_manager",
        "//util:secret_data",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ecies_aead_hkdf_hybrid_decrypt_test",
    size = "small",
    srcs = ["ecies_aead_hkdf_hybrid_decrypt_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_hybrid_decrypt",
        ":ecies_aead_hkdf_hybrid_encrypt",
        "//:hybrid_decrypt",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_gcm_key_manager",
        "//aead:xchacha20_poly1305_key_manager",
        "//daead:aes_siv_key_manager",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//subtle:random",
        "//subtle:subtle_util_boringssl",
        "//util:enums",
        "//util:status",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ecies_aead_hkdf_hybrid_encrypt_test",
    size = "small",
    srcs = ["ecies_aead_hkdf_hybrid_encrypt_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_hybrid_encrypt",
        "//:hybrid_encrypt",
        "//:registry",
        "//aead:aes_gcm_key_manager",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//subtle:random",
        "//subtle:subtle_util_boringssl",
        "//util:enums",
        "//util:status",
        "//util:statusor",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ecies_aead_hkdf_private_key_manager_test",
    size = "small",
    srcs = ["ecies_aead_hkdf_private_key_manager_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager",
        ":ecies_aead_hkdf_public_key_manager",
        ":hybrid_key_templates",
        "//:hybrid_decrypt",
        "//aead:aead_key_templates",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_gcm_key_manager",
        "//proto:aes_eax_cc_proto",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//subtle:hybrid_test_util",
        "//util:status",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "ecies_aead_hkdf_public_key_manager_test",
    size = "small",
    srcs = ["ecies_aead_hkdf_public_key_manager_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":ecies_aead_hkdf_private_key_manager",
        ":ecies_aead_hkdf_public_key_manager",
        "//:hybrid_encrypt",
        "//:registry",
        "//aead:aead_key_templates",
        "//aead:aes_gcm_key_manager",
        "//proto:aes_eax_cc_proto",
        "//proto:common_cc_proto",
        "//proto:ecies_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)
